package fh.visca;

import jssc.SerialPort;
import jssc.SerialPortException;

import javax.xml.bind.DatatypeConverter;

/**
 * Created by Tomek on 04.12.2016.
 */
public class ViscaPort {
    private SerialPort serialPort;

    public ViscaPort(String portName) throws SerialPortException {
        serialPort = new SerialPort(portName);
        if(serialPort.isOpened()){
        	serialPort.closePort();
        }
        serialPort.openPort();
        serialPort.setParams(9600, 8, 1, 0);
    }
    
    public void sendByteByport(byte[] comd) throws SerialPortException{
    	serialPort.writeBytes(comd);
    }
}